<template>
  <div>
    <div v-if="this.scrollDown" class="header">
      <i class="iconfont icon-icon_jiantou-zuo" @click="handleBack"></i>
      <slot></slot>
    </div>
    <div v-if="!this.scrollDown" class="header-top">
      <i class="iconfont icon-icon_jiantou-zuo" @click="handleBack"></i>
    </div>
  </div>
</template>

<script>
export default {
  name: "DetailHeader",
  props:{
    scrollDown:{
      type:Boolean,
      default:false
    }
  },
  methods:{
    handleBack(){
      this.$router.back()   // 返回上一个页面，与原生history.back()一样
    }
  }
}
</script>

<style lang="scss" scoped>
.header{
  width: 100vw;
  height: 44px;
  line-height: 44px;
  font-size: 17px;
  color: #191a1b;
  text-align: center;
  background-color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  border-bottom: 1px solid #ececec;
  z-index: 999;

  i{
    width: 30px;
    height: 30px;
    font-size: 18px;
    font-weight: 200;
    line-height: 30px;
    color: #656464;
    border-radius: 50%;
    text-align: center;
    position: absolute;
    top: 5px;
    left: 5px;
  }
}

.header-top{

  i{
    width: 30px;
    height: 30px;
    font-size: 18px;
    font-weight: 200;
    line-height: 30px;
    color: #484747;
    background: rgba(236,236,236,.6);
    border-radius: 50%;
    text-align: center;
    position: fixed;
    top: 5px;
    left: 5px;
  }
}
</style>
